<!DOCTYPE html>
<html>
<head>
<title>操作员管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
	var dataGrid;
	var winWidth =  700; //弹出窗口宽度
	var winHeight = 500; //弹出窗口高度
	var addTitle = "添加操作员"; //添加窗口标题
	var addUrl =  "/modules/system/operator/operatorAddPage.html"; // 添加窗口链接地址
	var editTitle = "编辑操作员"; //编辑窗口标题
	var resetMsg = "确定要重置该账号密码？";
	var editUrl =  "/modules/system/operator/operatorEditPage.html"; //编辑窗口链接地址
	var deleteUrl = "/modules/system/operator/operatorDelete.html";	//启用或禁用操作员地址
	var resetPwdUrl = "/modules/system/operator/operatorResetPwd.html";	//删除记录接口地址
	var txt1 = "禁用";
	var txt2 = "启用";
	var val1 = -1;
	var val2 = 0;
	$(function() {
		dataGrid = $('#dataGrid').datagrid({
			url : 'operatorList.html',  //表格数据接口地址
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageList : pageList,
			sortName : 'id',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
			columns : [ [
			{ field: 'id', title: '编号', width: 50, sortable:false },
			{ field: 'userName', title: '用户名', width: 80, sortable:false },
			{ field: 'status', title: '状态', width: 50, sortable:false ,
				formatter: function(value,row,index){
					if(value==0){
						return "启用"; 
					}else{
						return "禁用";
					}
          	  }
			},
			{ field: 'name', title: '用户姓名', width: 100,fixed: true, sortable:false },	
			{ field: 'department', title: '部门', width: 80, fixed: true,sortable:false },
			{ field: 'no', title: '工号', width: 80, fixed: true,sortable:false },
			{ field: 'phone', title: '电话', width: 100, sortable:false },
			{ field: 'mobile', title: '手机', width: 100, sortable:false },
			{ field: 'loginTime', title: '最后登录时间', width: 150,fixed:true, sortable:false,
				formatter: function(value,row,index){
					return getLocalTime(value,4);
				}
            },
            /*****************************************
             * 用浮层展示更多信息时，按以下格式命名，否则样式会丢失
             * field: 'showInfo'
			 * content中生成的html代码片段应如下结构，标签的顺序和class不要修改
			 * <a href="javascript:void(0);" class="j-showInfo">查看<i class="iconfont">&#xe639;</i></a>
			 * <div class="showInfoDiv">
			 * 	<div class="showInfo">
			 *		<em></em>
			 *		<h2>标题</h2>
			 *		<ul>
			 *			<li><span>用户名：</span>xxx</li>
			 *			...
			 *	 	</ul>
			 *	 </div>
			 * </div>	
             ******************************************/
            { field : 'showInfo',
                title : '其他信息',
                width :75,
                align:'center',
                fixed:true,
                formatter : function(value, row, index) {
					var content = '<a href="javascript:void(0);" class="j-showInfo">查看<i class="iconfont">&#xe639;</i></a>'
						+ '<div class="showInfoDiv">'
						+ '<div class="showInfo">'
						+ '<em></em><h2>操作员信息</h2>'
						+ '<ul>'
						+ '<li>'
                		+ '<span>Q Q：</span>'
						+ row.qq
						+ '</li>'
						+ '<li>'
                		+ '<span>邮箱：</span>'
						+ row.email
						+ '</li>'
						+ '<li>'
                		+ '<span>添加时间：</span>'
						+ getLocalTime(row.addTime,4)
						+ '</li>'
						+ '<li>'
                		+ '<span>备注：</span>'
						+ row.remark
						+ '</li>'
						+ '</ul></div></div>';
				return content;
				}
			},
			
            { field : 'action',
				title : '操作',
				width :75,
				fixed: true,
				align:'center',
				formatter : function(value, row, index) { //功能按钮添加
					var str = '';
					str += '<dl>';
					str += '<dt><a href="javascript:void(0);">详情</a><i class="iconfont">&#xe639;</i></dt>' ;
					str += '<dd>';
					str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
					if(row.status==0){
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.recordOptFun('+row.id+',deleteUrl,txt1,val1);">禁用</a>';
					}else{
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.recordOptFun('+row.id+',deleteUrl,txt2,val2);">启用</a>';
					}
					str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.deleteFun('+row.id+',resetPwdUrl,resetMsg);" title="重置账号密码">重置</a>';
					str += '</dd>'
					str +=  '</dl>'
					return str;
				}
			} ] ],
			toolbar : '#toolbar',
			onRowContextMenu : function(e, rowIndex, rowData) {
				e.preventDefault();
				$(this).datagrid('unselectAll').datagrid('uncheckAll');
				$(this).datagrid('selectRow', rowIndex);
				$('#menu').menu('show', {
					left : e.pageX,
					top : e.pageY
				});
			}
		});
	});		
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入用户名/姓名进行搜索" autocomplete="off" onkeydown="if(event.keyCode == 13){ $.fn.dataGridOptions.searchFun('#searchForm');return false;}"/><a href="javascript:;" title="查询" class="sBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">查询</a>
	            	<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
            <div class="sRight">
				<a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加</a>		
            </div>
            <form id="showAdw">
	        </form>		
		</div>		
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>
